import { defineStore } from "pinia";
import { ref } from "vue";

export const useAppStore = defineStore("app", () => {
  // 侧边栏折叠状态
  const sidebarCollapsed = ref(false);
  // echarts 图表文本颜色   需要根据主题变化而变化
  const echartsTextColor = ref("#FFF");

  /**
   * @description 切换侧边栏折叠状态
   */
  const toggleSidebar = () => {
    sidebarCollapsed.value = !sidebarCollapsed.value;
  };

  /**
   * @description 设置侧边栏折叠状态
   * @param {boolean} status - 折叠状态
   */
  const setSidebarCollapsed = (status) => {
    sidebarCollapsed.value = status;
  };

  const setEchartsTextColor = (color) => {
    echartsTextColor.value = color;
  };

  return {
    sidebarCollapsed,
    echartsTextColor,
    toggleSidebar,
    setSidebarCollapsed,
    setEchartsTextColor,
  };
});
